<template>
    <nav v-show="secondShow" @click.stop id="menu" class="menu" :class="{'menuTransiIn':menuTransiIn,'menuTransiOut':!menuTransiIn}" >
        <keep-alive>
            <v-detail  @loadEnd="loadEnd"></v-detail> 
        </keep-alive>    
        <div class="closeImg" @click.stop="fadeOut">
             <span><i class="icon-previous"></i>返回</span>
        </div>      
    </nav>
</template>

<script>
import Vue from 'vue'
import ApproDetail from '@/components/leader/leaderDetail'
export default {
        name: 'panel',
        data(){
        return {
            menuTransiIn:false,
        }
    },
    components:{
        'v-detail':ApproDetail
    },

    watch:{
        secondShow:function(newVal,oldVal){
            // if (newVal) {
            //     setTimeout(()=>{
            //         this.menuTransiIn = true;
            //     },100)            
            // }
        }
    },

    methods:{
        fadeOut:function(){
            this.menuTransiIn = false;
            setTimeout(()=>{
                this.$emit('update:isShow',false);
            },300)
        },
        loadEnd:function(){
            this.$emit('loadEnd');
            setTimeout(()=>{
                this.menuTransiIn = true;
            },100)
        }
    },
    props:['isShow','isFirstShow','secondShow'],
    created(){
        
    },
    mounted(){
        this.$emit('update:isFirstShow',false)
        
    }
  }
</script>

<style lang="less" scoped>
 .closeImg{
    width: 100%;
    height: 1rem;
    line-height: 1rem;
    margin: auto auto;
    position: fixed;
    bottom: 0;
    color: #26a2ff;
    z-index: 9000;
    text-align: center;
    // border-top: 0.02rem solid #F3F3F3;
    background-color: #F3F3F3;
}
.closeImg i{
    margin-right:0.06rem;
}
.menu{
  position: fixed;
  padding-bottom:1rem;
  top: 0;
  bottom: 0;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  background-color:#fff;
  -ms-touch-action:none;touch-action:none;
  -webkit-touch-action:none;
//   line-height:100vh;
  width:100vw;
  height:100vh;
  position:fixed;
  top:0;left:0;
  z-index: 9000;
//   transition:transform .3s;
//   -ms-transition:transform .3s;
//   -moz-transition:transform .3s;
//   -webkit-transition:transform .3s;
//   -o-transition:transform .3s;
  transform:translate3d(100%,0,0);
  -webkit-transform:translate3d(100%,0,0);
  -ms-transform:translate3d(100%,0,0);
  -o-transform:translate3d(100%,0,0);
  -moz-transform:translate3d(100%,0,0)
}
.menuShow{
    left: 100vw;
    display:block;
}
.menuHide{
    display:none;
}
.menuTransiIn{
    transition: transform 0.5s ease-out;
    -webkit-transform:translate3d(0vw, 0px, 0px);
    -ms-transform:translate3d(0vw, 0px, 0px);
    -o-transform:translate3d(0vw, 0px, 0px);
    -moz-transform:translate3d(0vw, 0px, 0px);
    transform: scale3d(1, 1, 1) translate3d(0vw, 0px, 0px);
}
.menuTransiOut{
    transition: transform 0.5s ease-out;
    -webkit-transform:translate3d(100vw, 0px, 0px);
    -ms-transform:translate3d(100vw, 0px, 0px);
    -o-transform:translate3d(100vw, 0px, 0px);
    -moz-transform:translate3d(100vw, 0px, 0px);
    transform: scale3d(1, 1, 1) translate3d(100vw, 0px, 0px);
}




</style>